import ActionManager from "../actions/ActionManager";
import { ActionType, EventName } from "../../../public/Config";
import GlobalEvent from "../../../cfw/event/GlobalEvent";

const {ccclass, property} = cc._decorator;

@ccclass
export default class ChangeActionView extends cc.Component {


    @property(cc.Node)
    eyelid: cc.Node = null;

    @property(cc.Node)
    legs: cc.Node = null;


    protected action: ActionManager = new ActionManager()

    start () {
        this.action.self = this;
        GlobalEvent.instance().on(EventName.CHANGE_PLAYER_ACTION, this.setAction, this)
    }

    onDestroy(){
        GlobalEvent.instance().off(EventName.CHANGE_PLAYER_ACTION, this.setAction, this)
    }

    setAction(type: ActionType, param?) {
        cc.log(" PlayerView setAction ")
        this.action.start(type, param)
    }
    // update (dt) {}
}
